#include <iostream>
#include <string>
using namespace std;
typedef unsigned long long ull;

class BigInt {
  ull high, low;
  bool isOne(unsigned int n);

 public:
  BigInt();
  BigInt(const ull &low);
  BigInt(const ull &high, const ull &low);
  BigInt(const string &str);
  ~BigInt();
  void display(unsigned int base=10) const;
  bool operator<(const BigInt &rhs) const;
  bool operator==(const BigInt &rhs) const;
  bool operator!=(const BigInt &rhs) const { return !(*this == rhs); }

  BigInt &operator+=(const BigInt &rhs);
  BigInt &operator-=(const BigInt &rhs);
  BigInt &operator++();
  BigInt &operator++(int);
  BigInt &operator--();
  BigInt &operator--(int);
  BigInt &operator/=(const BigInt &other);
  BigInt &operator%=(const BigInt &other);
  BigInt &operator*=(const BigInt &other);
  BigInt &operator<<=(unsigned int n);
  BigInt &operator>>=(unsigned int n);

  string toString(unsigned int base = 10) const;
  BigInt &fromString(const string &str, unsigned int base = 10);

  operator string() const;
  operator ull() const;

  ull operator[](const char *str);
  char operator[](unsigned int n);
  char operator()(int n, unsigned int base = 10);

  friend BigInt operator+(const BigInt &lhs, const BigInt &rhs);
  friend BigInt operator-(const BigInt &lhs, const BigInt &rhs);
  friend BigInt operator/(const BigInt &lhs, const BigInt &rhs);
  friend BigInt operator%(const BigInt &lhs, const BigInt &rhs);
  friend BigInt operator*(const BigInt &lhs, const BigInt &rhs);

  friend BigInt operator<<(const BigInt &u, unsigned int n);
  friend BigInt operator>>(const BigInt &u, unsigned int n);

  friend ostream &operator<<(ostream &out, const BigInt &u);
  friend istream &operator>>(istream &in, BigInt &u);
};

BigInt::BigInt() : high((ull)0), low((ull)0) {}
BigInt::BigInt(const ull &low) : high((ull)0), low(low) {}
BigInt::BigInt(const ull &high, const ull &low) : high(high), low(low) {}
BigInt::BigInt(const string &str) { fromString(str); }
BigInt::~BigInt() {}
void BigInt::display(unsigned int base) const {
  string str = "";
  BigInt t = *this, BASE((ull)base);
  while (t != (BigInt)0LLU) {  // t不等于0
    int ch = (t % BASE).low % base;
    if (ch < 10)
      str.insert(str.begin(), (char)(ch + '0'));
    else
      str.insert(str.begin(), (char)(ch + 'A' - 10));
    t /= BASE;
  }
  cout << str;
}

bool BigInt::operator<(const BigInt &rhs) const {
  return high < rhs.high || (high == rhs.high && low < rhs.low);
}

bool BigInt::operator==(const BigInt &rhs) const {
  return high == rhs.high && low == rhs.low;
}

BigInt &BigInt::operator+=(const BigInt &rhs) {
  ull flag = low + rhs.low < low;
  high += rhs.high + flag;
  low += rhs.low;
  return *this;
}

BigInt &BigInt::operator-=(const BigInt &rhs) {
  ull borrow = low < rhs.low;  // 检查借位
  low += (~rhs.low) + 1;       // 补码运算
  high -= rhs.high + borrow;
  return *this;
}

BigInt operator+(const BigInt &lhs, const BigInt &rhs) {
  BigInt b(lhs);
  b += rhs;
  return b;
}

BigInt operator-(const BigInt &lhs, const BigInt &rhs) {
  BigInt b(lhs);
  b -= rhs;
  return b;
}

BigInt &BigInt::operator++() {
  low++;
  if (low == 0) high++;
  return *this;
}

BigInt &BigInt::operator--() {
  low--;
  return *this;
}

BigInt &BigInt::operator++(int) {
  low++;
  if (low == 0) high++;
  return *this;
}

BigInt &BigInt::operator--(int) {
  low--;
  return *this;
}
// 剩余要求：*，/ ,% ，*=，/=,%=
bool BigInt::isOne(unsigned int n) {
  if (0 <= n && n <= 63)
    return low & ((ull)1 << n);
  else if (64 <= n && n < 128)
    return high & ((ull)1 << (n - 64));
  else
    return false;
}

BigInt &BigInt::operator<<=(unsigned int n) {
  if (0 == n) {                    // 0位
  } else if (1 <= n && n <= 63) {  // 1~63位
    high <<= n;
    high |= (low >> (64 - n));
    low <<= n;
  } else if (64 <= n && n <= 127) {  // 64~127位
    high = low;
    high <<= (n - 64);
    low = 0;
  } else if (128 <= n) {  // 128及以上
    high = 0;
    low = 0;
  }
  return *this;
}

BigInt &BigInt::operator>>=(unsigned int n) {
  if (0 == n) {                    // 0位
  } else if (1 <= n && n <= 63) {  // 1~63位
    low >>= n;
    low |= (high << (64 - n));
    high >>= n;
  } else if (64 <= n && n <= 127) {  // 64~127位
    low = high;
    low >>= (n - 64);
    high = 0;
  } else if (128 <= n) {  // 128及以上
    high = 0;
    low = 0;
  }
  return *this;
}

BigInt operator<<(const BigInt &u, unsigned int n) {
  BigInt result(u);
  result <<= n;
  return result;
}

BigInt operator>>(const BigInt &u, unsigned int n) {
  BigInt result(u);
  result >>= n;
  return result;
}

BigInt &BigInt::operator/=(const BigInt &other) {
  // 模拟二进制除法
  BigInt u(*this), v(other);  ////表示当前被除数,当前除数
  high = low = (ull)0LLU;     // 商初始为0
  // 如果v<u,把v*2变大。如果v最高位是1，再变大就会溢出的了，所以也不能变大了。
  while (v < u && !v.isOne(sizeof(BigInt) * 8 - 1))  //
    v <<= 1;
  while (!(v < other)) {  // 如果当前除数v大于等于除数，继续算。小于other结束。
    *this <<= 1;     // 位左移1位，空出末位
    if (!(u < v)) {  // 被除数大于等于除数
      u -= v;
      (*this)++;
    }
    v >>= 1;  // v 去掉1位。位右移1位。
  }
  return *this;
}

BigInt operator/(const BigInt &lhs, const BigInt &rhs) {
  // 模拟二进制除法
  BigInt u(lhs), v(rhs);  ////表示当前被除数,当前除数
  BigInt b = lhs;
  b.high = b.low = (ull)0LLU;  // 商初始为0
  // 如果v<u,把v*2变大。如果v最高位是1，再变大就会溢出的了，所以也不能变大了。
  while (v < u && !v.isOne(sizeof(BigInt) * 8 - 1))  //
    v <<= 1;
  while (!(v < rhs)) {  // 如果当前除数v大于等于除数，继续算。小于other结束。
    b <<= 1;         // 位左移1位，空出末位
    if (!(u < v)) {  // 被除数大于等于除数
      u -= v;
      b++;
    }
    v >>= 1;  // v 去掉1位。位右移1位。
  }
  return b;
}

BigInt &BigInt::operator%=(const BigInt &other) {
  // 模拟二进制除法
  BigInt v(other);  // 表示当前数
  // 如果v<*this,把v*2变大。如果v最高位是1，再变大就会溢出的了，所以也不能变大了。
  while (v < *this && !v.isOne(sizeof(BigInt) * 8 - 1)) v <<= 1;
  while (!(v < other)) {  // 如果当前除数v大于等于除数，继续算。小于other结束。
    if (!(*this < v))  // 被除数大于等于除数
      *this -= v;
    v >>= 1;  // v 去掉1位。位右移1位。
  }
  return *this;
}

BigInt operator%(const BigInt &lhs, const BigInt &rhs) {
  // 模拟二进制除法
  BigInt v(rhs);  // 表示当前数
  BigInt b = lhs;
  // 如果v<*this,把v*2变大。如果v最高位是1，再变大就会溢出的了，所以也不能变大了。
  while (v < b && !v.isOne(sizeof(BigInt) * 8 - 1)) v <<= 1;
  while (!(v < rhs)) {  // 如果当前除数v大于等于除数，继续算。小于other结束。
    if (!(b < v))  // 被除数大于等于除数
      b -= v;
    v >>= 1;  // v 去掉1位。位右移1位。
  }
  return b;
}

BigInt &BigInt::operator*=(const BigInt &other) {
  BigInt w(*this), m(other), result(0);
  while (m != (BigInt)0LLU) {
    if (m.low & 1) {  // 检查末位是否为1
      result += w;
    }
    w <<= 1;
    m >>= 1;
  }
  *this = result;
  return *this;
}

BigInt operator*(const BigInt &lhs, const BigInt &rhs) {
  BigInt b(lhs);
  b *= rhs;
  return b;
}

string BigInt::toString(unsigned int base) const {
  string str = "";
  BigInt temp(*this), b((ull)base);
  while (temp != (BigInt)0LLU) {
    int t = (ull)(temp % b) % base;
    if (t < 10) {
      str.insert(str.begin(), (char)(t + '0'));
    } else {
      str.insert(str.begin(), (char)t + ('A' - 10));
    }
    temp /= b;
  }
  return str;
}

BigInt &BigInt::fromString(const string &str, unsigned int base) {
  *this = (BigInt)(ull)(0LLU);
  for (int i = 0; i < str.length(); i++) {
    if (isdigit(str[i]))
      *this = *this * (BigInt)(ull)base + (BigInt)(ull)(str[i] - '0');
    else if (isupper(str[i]))
      *this = *this * (BigInt)(ull)base + (BigInt)(ull)(str[i] - 'A' + 10);
    else if (islower(str[i]))
      *this = *this * (BigInt)(ull)base + (BigInt)(ull)(str[i] - 'a' + 10);
  }
  return *this;
}

BigInt::operator string() const { return toString(10); }

BigInt::operator ull() const { return low; }

ull BigInt::operator[](const char *str) {
  string s(str);
  if (s == "high")
    return high;
  else if (s == "low")
    return low;
  else
    throw "error";
}

char BigInt::operator[](unsigned int n) {
  string str = (string) * this;
  if (n >= str.length())
    return '0';
  else
    return str[str.length() - n - 1];
}

char BigInt::operator()(int n, unsigned int base) {
  string str = toString(base);
  if (n < 0 || n >= str.length ()) return '0';
  return str[str.length() - n - 1];
}

ostream &operator<<(ostream &out, const BigInt &u) { return out << (string)u; }

istream &operator>>(istream &in, BigInt &u) {
  string str;
  in >> str;
  u.fromString(str, 10);
  return in;
}

// int main(){
//   BigInt u1(1LLU);
//   for(int i=0;i<128;i++){
//     cout<<"2^"<<i<<":";
//     (u1<<i).display(10);
//     cout<<endl;
//   }
// }

int main() {
  BigInt u1, u2;
  cin >> u1 >> u2;
  u1.display();
  cout << endl;
  u2.display();
  cout << endl;
  cout << u1 << "+" << u2 << "=" << u1 + u2 << endl;
  cout << u1 << "-" << u2 << "=" << u1 - u2 << endl;
  cout << u1 << "*" << u2 << "=" << u1 * u2 << endl;
  cout << u1 << "/" << u2 << "=" << u1 / u2 << endl;
  cout << u1["high"] << " " << u1["low"] << endl;
  // 输出u1十进制的第2位，十六进制的第2位，十进制的第2位。最低位是0位。
  cout << u1(2, 10) << " " << u1(2, 16) << " " << u1(2) << endl;
  return 0;
}

// cr bigInt

// 第九周任务：
// 1）重载提取符>>,插入符<<
// 2)重载[],()
// 3)BigInt和string类型相互转换，BigInt和ull类型相互转换。